package com.googlecode.lohr.parser.combinators.node;

import java.util.List;

import com.googlecode.lohr.parser.combinators.matcher.Matcher;

/**
 * A node that just wraps another node
 * @author Ted Stockwell
 *
 */
public class FilterNode extends NativeNode
{
	private AbstractNode _node;
	
	public FilterNode(Matcher matcher, AbstractNode node)
	{
		_node= node;
		setMatcher(matcher);		
		assert _node != null;
		this.end= node.getEnd();
		this.start= node.getStart();
	}
	
	public void setWrappedNode(AbstractNode node) {
		_node= node;
		assert _node != null;
	}
	
	public AbstractNode getWrappedNode() {
		return _node;
	}

	@Override
	public int length() {
		return _node.length();
	}

	@Override
	public int getStart() {
		return _node.getStart();
	}

	@Override
	public void setChildren(List<AbstractNode> children) {
		_node.setChildren(children);
	}

	@Override
	public void setChildren(AbstractNode[] children) {
		_node.setChildren(children);
	}

	@Override
	public void setStart(int value) {
		_node.setStart(value);
	}

	@Override
	public void setEnd(int value) {
		_node.setEnd(value);
	}

	@Override
	public List<AbstractNode> getChildren() {
		return _node.getChildren();
	}

	@Override
	public String getText() {
		return _node.getText();
	}

	@Override
	public String toString() {
		return _node.toString();
	}

	@Override
	public void accept(NodeVistor visitor) {
		_node.accept(visitor);
	}

	@Override
	public int getEnd() {
		return _node.getEnd();
	}
}
